
<?
	  include("/inc/header.html") {}
    ?>    
    
            
                            <div class="panel panel" >          
                                <div class="panel-body pan"  >
                                        <div class="form-body pal" >
                                            <div class="row">
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                     <label for="inputUsername" >数据集标识 <span class='require'>*</span> </label>
                                                        <div class="input-icon right">
                                                          <input id="doi" type="text" class="form-control" onchange="voluation(this.value);"/>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                     <label for="inputUsername" >数据集名称 <span class='require'>*</span> </label>
                                                        <div class="input-icon right">
                                                            <input id="datasetName" type="text" class="form-control" />
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <div class="input-icon right">   
                                                         <label for="inputUsername" >数据集数量 <span class='require'>*</span> </label>
                                                            <input id="recordNum" type="text" class="form-control" />
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <div class="input-icon right">
                                                         <label for="inputUsername" >更新周期<span class='require'>*</span> </label>
                                                            <input id="updateFreq" type="text" class="form-control" />
                                                        </div>
                                                    </div>
                                                </div>
                                                
                                                 <div class="col-md-6">
                                            <div class="form-group"><label for="inputUsername" >部门名称 <span class='require'>*</span> </label>
								   <div class="input-group input-group-sm mbs" >
									 <input id="parentclassname" type="text"   class="form-control" disabled="true"  />
									 <span class="input-group-btn"><button onclick="saveclassZTree()" type="button" data-toggle="dropdown" class="btn btn-success dropdown-toggle">选择字段..</button></span>
							 <input id="parentClassid" type="hidden"  class="form-control" /> 
						
								</div>
								</div></div>
								</div>
                                          
                                            <hr/>
                                            <div class="row">
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <div class="input-icon right">
                                                         <label for="inputUsername" >类别名称<span class='require'>*</span> </label>
                                                            <input id="categoryName" type="text" class="form-control" />
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <div class="input-icon right">
                                                         <label for="inputUsername" >类别编码<span class='require'>*</span> </label>
                                                            <input id="categoryCode" type="text" class="form-control" />
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <div class="input-icon right">
                                                         <label for="inputUsername" >分类标准<span class='require'>*</span> </label>
                                                            <input id="categoryType" type="text" class="form-control" />
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <div class="input-icon right">
                                                         <label for="inputUsername" >数据编码<span class='require'>*</span> </label>
                                                            <input id="characterSet" type="text" class="form-control" />
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <div class="input-icon right">
                                                         <label for="inputUsername" >语种<span class='require'>*</span> </label>
                                                            <input id="language" type="text" class="form-control" />
                                                        </div>
                                                    </div>
                                                </div>
                                                  <div class="col-md-6">
                                                    <div class="form-group">
                                                        <div class="input-icon right">
                                                         <label for="inputUsername" >关键词<span class='require'>*</span> </label>
                                                            <input id="keywords" type="text" class="form-control" />
                                                        </div>
                                                    </div>
                                                </div>
                                                  <div class="col-md-6">
                                                    <div class="form-group">
                                                        <div class="input-icon right">
                                                         <label for="inputUsername" >摘要<span class='require'>*</span> </label>
                                                            <input id="abstracts" type="text" class="form-control" />
                                                        </div>
                                                    </div>
                                                </div>
                                                </div>                     
                                              <hr/>
                                            <div class="row">
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <div class="input-icon right">
                                                         <label for="inputUsername" >负责人姓名<span class='require'>*</span> </label>
                                                            <input id="individualName" type="text" class="form-control" />
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <div class="input-icon right">
                                                         <label for="inputUsername" >负责单位名称<span class='require'>*</span> </label>
                                                            <input id="organizationName" type="text" class="form-control" />
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <div class="input-icon right">
                                                         <label for="inputUsername" >固话<span class='require'>*</span> </label>
                                                            <input id="telephone" type="text" class="form-control" />
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <div class="input-icon right">
                                                         <label for="inputUsername" >手机<span class='require'>*</span> </label>
                                                            <input id="mobilePhone" type="text" class="form-control" />
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <div class="input-icon right">
                                                         <label for="inputUsername" >传真<span class='require'>*</span> </label>
                                                            <input id="fax" type="text" class="form-control" />
                                                        </div>
                                                    </div>
                                                </div>
                                                  <div class="col-md-6">
                                                    <div class="form-group">
                                                        <div class="input-icon right">
                                                         <label for="inputUsername" >Email<span class='require'>*</span> </label>
                                                            <input id="email" type="text" class="form-control" />
                                                        </div>
                                                    </div>
                                                </div>
                                                  <div class="col-md-6">
                                                    <div class="form-group">
                                                        <div class="input-icon right">
                                                         <label for="inputUsername" >详细地址<span class='require'>*</span> </label>
                                                            <input id="address" type="text" class="form-control" />
                                                        </div>
                                                    </div>
                                                </div>
                                                  <div class="col-md-6">
                                                    <div class="form-group">
                                                        <div class="input-icon right">
                                                         <label for="inputUsername" >邮政编码<span class='require'>*</span> </label>
                                                            <input id="postalCode" type="text" class="form-control" />
                                                        </div>
                                                    </div>
                                                </div>
                                                  <div class="col-md-6">
                                                    <div class="form-group">
                                                        <div class="input-icon right">
                                                         <label for="inputUsername" >安全级别<span class='require'>*</span> </label>
                                                            <input id="securityLevel" type="text" class="form-control" />
                                                        </div>
                                                    </div>
                                                </div>
                                                  <div class="col-md-6">
                                                    <div class="form-group">
                                                        <div class="input-icon right">
                                                         <label for="inputUsername" >操作权限<span class='require'>*</span> </label>
                                                            <input id="operatingAuthorization" type="text" class="form-control" />
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <div class="input-icon right">
                                                         <label for="inputUsername" >计费标识<span class='require'>*</span> </label>
                                                            <input id="chargeId" type="text" class="form-control" />
                                                        </div>
                                                    </div>
                                                </div>
                                                </div> 
                                </div>
                            </div>   
                        </div>
                   


<script>
	var index1 = window.parent.getlay();
	$(function() {
		admindata();	
	});
	//数据属性下拉
	function admindata() {
		$.ajax({
			type : "post",
			url : "./Knowledgeadminall.do",
			data : {},
			dataType : "json",
			success : function(data) {
				$(data).each(
						function(n) {
							$("<option/>").html(data[n].name).val(data[n].id)
									.appendTo("#createUserId");
						});
			},
			error : function(data) {
				alert("请求失败");
			}
		});
		if (index1 != 0) {
			demo1();
		}
	}

	function Page() {
	
	     if ($.trim($("#datasetName").val()).length < 1) {
				alert('数据集名字不能为空！');
				return null;
			}
			if ($.trim($("#recordNum").val()).length < 1) {
				alert('数据集数量不能为空！');
				return null;
			}
			if ($.trim($("#categoryName").val()).length < 1) {
				alert('分类不能为空！');
				return null;
			}
			
	     if ($.trim($("#postalCode").val()).length < 1) {
				alert('邮政编码不能为空！');
				return null;
			}
			if (isNaN($("#postalCode").val())) {
				alert("邮政编码必须是数字");
				return null;
			}
	     var count="";
       count+="doi"+","+$("#doi").val()+",";
       count+="datasetName"+","+$("#datasetName").val()+",";
       count+="recordNum"+","+$("#recordNum").val()+",";
       count+="updateFreq"+","+$("#updateFreq").val()+",";
       count+="updateTime"+","+$("#updateTime").val()+",";
       count+="categoryName"+","+$("#categoryName").val()+",";
       count+="categoryCode"+","+$("#categoryCode").val()+",";
       count+="categoryType"+","+$("#categoryType").val()+",";
       count+="characterSet"+","+$("#characterSet").val()+",";
       count+="language"+","+$("#language").val()+",";
       count+="keywords"+","+$("#keywords").val()+",";
       count+="abstracts"+","+$("#abstracts").val()+",";
       count+="individualName"+","+$("#individualName").val()+",";
       count+="organizationName"+","+$("#organizationName").val()+",";
       count+="telephone"+","+$("#telephone").val()+",";
       count+="mobilePhone"+","+$("#mobilePhone").val()+",";
       count+="fax"+","+$("#fax").val()+",";
       count+="email"+","+$("#email").val()+",";
       count+="address"+","+$("#address").val()+",";
       count+="postalCode"+","+$("#postalCode").val()+",";
       count+="securityLevel"+","+$("#securityLevel").val()+",";
       count+="operatingAuthorization"+","+$("#operatingAuthorization").val()+",";
       count+="chargeId"+","+$("#chargeId").val()+",";
		$.ajax({
			type : "post",
			url : "./KnowledgeDataRegistersave.do",
			data : {
				"id" : index1,
				"count" : count,
				"createUserId" : $("#parentClassid").val()
			},
			dataType : "json",
			async : false,
			success : function(data) {
				var index = parent.layer.getFrameIndex(window.name);
				window.parent.get();
				parent.layer.msg('添加或编辑成功');
				parent.layer.close(index);
			},
			error : function(data) {
				alert("请求失败");
			}
		});

	}

	function demo1() {
		$.getJSON('./KnowledgeDataRegisteredit.do',
				{
					id : index1
				//向服务端传的参数，此处只是演示
				}, function(res) {
					//alert(res[0].dataType.id);
					//此处仅仅是为了演示变化的内容
					$("#parentClassid").val(res[0].createUserId);
					
					$("#parentclassname").val(res[0].createUser.name);
					$("#doi").val(res[0].doi);
					$("#datasetName").val(res[0].datasetName);
					$("#recordNum").val(res[0].recordNum);
					$("#updateFreq").val(res[0].updateFreq);
					$("#updateTime").val(res[0].updateTime);
					$("#categoryName").val(res[0].categoryName);
					$("#categoryCode").val(res[0].categoryCode);
					$("#categoryType").val(res[0].categoryType);
					$("#characterSet").val(res[0].characterSet);
					$("#language").val(res[0].language);
					$("#keywords").val(res[0].keywords);
					$("#abstracts").val(res[0].abstracts);
					$("#individualName").val(res[0].individualName);
					$("#organizationName").val(res[0].organizationName);				
					$("#telephone").val(res[0].telephone);
					$("#mobilePhone").val(res[0].mobilePhone);
					$("#fax").val(res[0].fax);
					$("#email").val(res[0].email);
					$("#address").val(res[0].address);
					$("#postalCode").val(res[0].postalCode);					
					$("#securityLevel").val(res[0].securityLevel);
					$("#operatingAuthorization").val(res[0].operatingAuthorization);
					$("#chargeId").val(res[0].chargeId);
					
				});
	};
	function selected(selectname, selectid) {
		$("#" + selectname + " option").each(function() { //遍历全部option
			var v = $(this).val(); //获取option的内容
			if (v == selectid) {
				$(this).attr("selected", "selected");
			}
		});
	}
	function voluation(name) {
		if ($.trim(name).length < 1) {
			alert('英文名不能为空！');
			return null;
		}
		$.ajax({
			type : "post",
			url : "./KnowledgeDataRegisterProving.do",
			data : {
				"name" : name,
			},
			async : false,
			dataType : "json",
			success : function(data) {
				if (data.result != 1) {
					alert("数据集标识不可用，重命名或者不符合规则");
					$("#doi").val("");
				}

			},
			error : function(data) {
				alert("请求失败");
			}
		});
  
	}
	//选择父类
	function saveclassZTree() {
		layer.open({
			type : 2,
			area : [ '360px', '400px' ],
			fix : false, //不固定
			scrollbar : false,
			shadeClose : true,
			move : false,
			title:"部门选择",
			skin : 'layui-layer-rim', //加上边框
			btn : [ '保存 ', '关闭' ],
			content : ["user-editSave-department-zTree.html", 'no'],
			yes : function(index,layer) {		
			  var iframeWin = parent.window[window.name].window[layer.find('iframe')[0]['name']];
			  			  iframeWin.save();
			},
			cancel : function(index) {
			}
		});
	}
</script>


